---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  D:\research\china\decentralization\dofiles\tab_data\tabdata5-3empcen.log
  log type:  text
 opened on:  29 Jul 2014, 12:09:45

. set linesize 255

. 
. *****************************************************
. * EMPLOYMENT COUNTS BY INDUSTRY BY YEAR
. *****************************************************
. /*
> PURPOSE: combine census and enterprise employment counts by year x industry
> 
> CHANGES:
> - 8/27: focus on census 95 and 08 employment counts.
> */
. *****************************************************
. * Date created: 8/16/2013 by Ying Chen
. * Date updated: 8/27/2013
. *****************************************************
. * Files in:
. global cnsct2 "..\..\data\empcensus\generated\cns_emp_count_newind.dta"

. global corr "..\..\data\correspondence_tables\generated\correspondence_82_10.dta"

. * Files out:
. global out2 "..\..\data\empcensus\generated\emp_count_newind.dta"

. *****************************************************
. ******************************
. * unit_code_common and cc05 crosswalk
. ******************************
. use $corr, clear

. drop if unit_code_common==.
(84 observations deleted)

. contract unit_code_common city05 cp90

. rename city05 cc05

. drop _freq

. tempfile corr

. save `corr'
file C:\Users\NATHAN~1\AppData\Local\Temp\ST_02000001.tmp saved

. 
. * Updated on 8/27. 
. use $cnsct2, clear

. merge m:1 unit_code_common using `corr'

    Result                           # of obs.
    -----------------------------------------
    not matched                             0
    matched                             4,652  (_merge==3)
    -----------------------------------------

. drop _me

. tempfile main

. save `main'
file C:\Users\NATHAN~1\AppData\Local\Temp\ST_02000002.tmp saved

. 
. * Pref level
. use `main', clear

. collapse (sum) unit_emp food_emp trad_emp txtlaprl_emp plstc_emp nonmtl_emp metals_emp metal_emp metalpdct_emp machinery_emp cptNinst_emp ht_emp nonht_emp aprl_emp eduspt_emp geq_emp seq_emp trans_emp ptran_emp eeq_emp comm_emp inst_emp art_emp lghttrad
> _emp hvytrad_emp plstcNrbbr_emp allhvy_emp allmdm_emp, by(year cc05)

. reshape wide unit_emp food_emp trad_emp txtlaprl_emp plstc_emp nonmtl_emp metals_emp metal_emp metalpdct_emp machinery_emp cptNinst_emp ht_emp nonht_emp aprl_emp eduspt_emp geq_emp seq_emp trans_emp ptran_emp eeq_emp comm_emp inst_emp art_emp lghttrad_e
> mp hvytrad_emp plstcNrbbr_emp allhvy_emp allmdm_emp, i(cc05) j(year)
(note: j = 1995 2008)

Data                               long   ->   wide
-----------------------------------------------------------------------------
Number of obs.                      572   ->     286
Number of variables                  30   ->      57
j variable (2 values)              year   ->   (dropped)
xij variables:
                               unit_emp   ->   unit_emp1995 unit_emp2008
                               food_emp   ->   food_emp1995 food_emp2008
                               trad_emp   ->   trad_emp1995 trad_emp2008
                           txtlaprl_emp   ->   txtlaprl_emp1995 txtlaprl_emp2008
                              plstc_emp   ->   plstc_emp1995 plstc_emp2008
                             nonmtl_emp   ->   nonmtl_emp1995 nonmtl_emp2008
                             metals_emp   ->   metals_emp1995 metals_emp2008
                              metal_emp   ->   metal_emp1995 metal_emp2008
                          metalpdct_emp   ->   metalpdct_emp1995 metalpdct_emp2008
                          machinery_emp   ->   machinery_emp1995 machinery_emp2008
                           cptNinst_emp   ->   cptNinst_emp1995 cptNinst_emp2008
                                 ht_emp   ->   ht_emp1995 ht_emp2008
                              nonht_emp   ->   nonht_emp1995 nonht_emp2008
                               aprl_emp   ->   aprl_emp1995 aprl_emp2008
                             eduspt_emp   ->   eduspt_emp1995 eduspt_emp2008
                                geq_emp   ->   geq_emp1995 geq_emp2008
                                seq_emp   ->   seq_emp1995 seq_emp2008
                              trans_emp   ->   trans_emp1995 trans_emp2008
                              ptran_emp   ->   ptran_emp1995 ptran_emp2008
                                eeq_emp   ->   eeq_emp1995 eeq_emp2008
                               comm_emp   ->   comm_emp1995 comm_emp2008
                               inst_emp   ->   inst_emp1995 inst_emp2008
                                art_emp   ->   art_emp1995 art_emp2008
                           lghttrad_emp   ->   lghttrad_emp1995 lghttrad_emp2008
                            hvytrad_emp   ->   hvytrad_emp1995 hvytrad_emp2008
                         plstcNrbbr_emp   ->   plstcNrbbr_emp1995 plstcNrbbr_emp2008
                             allhvy_emp   ->   allhvy_emp1995 allhvy_emp2008
                             allmdm_emp   ->   allmdm_emp1995 allmdm_emp2008
-----------------------------------------------------------------------------

. rename *_emp???? *_emp????_pref

. tempfile p

. save `p'
file C:\Users\NATHAN~1\AppData\Local\Temp\ST_02000003.tmp saved

. 
. * CP10 level
. use `main', clear

. keep if cp90==1
(3342 observations deleted)

. collapse (sum) unit_emp food_emp trad_emp txtlaprl_emp plstc_emp nonmtl_emp metals_emp metal_emp metalpdct_emp machinery_emp cptNinst_emp ht_emp nonht_emp aprl_emp eduspt_emp geq_emp seq_emp trans_emp ptran_emp eeq_emp comm_emp inst_emp art_emp lghttrad
> _emp hvytrad_emp plstcNrbbr_emp allhvy_emp allmdm_emp, by(year cc05)

. reshape wide unit_emp food_emp trad_emp txtlaprl_emp plstc_emp nonmtl_emp metals_emp metal_emp metalpdct_emp machinery_emp cptNinst_emp ht_emp nonht_emp aprl_emp eduspt_emp geq_emp seq_emp trans_emp ptran_emp eeq_emp comm_emp inst_emp art_emp lghttrad_e
> mp hvytrad_emp plstcNrbbr_emp allhvy_emp allmdm_emp, i(cc05) j(year)
(note: j = 1995 2008)

Data                               long   ->   wide
-----------------------------------------------------------------------------
Number of obs.                      572   ->     286
Number of variables                  30   ->      57
j variable (2 values)              year   ->   (dropped)
xij variables:
                               unit_emp   ->   unit_emp1995 unit_emp2008
                               food_emp   ->   food_emp1995 food_emp2008
                               trad_emp   ->   trad_emp1995 trad_emp2008
                           txtlaprl_emp   ->   txtlaprl_emp1995 txtlaprl_emp2008
                              plstc_emp   ->   plstc_emp1995 plstc_emp2008
                             nonmtl_emp   ->   nonmtl_emp1995 nonmtl_emp2008
                             metals_emp   ->   metals_emp1995 metals_emp2008
                              metal_emp   ->   metal_emp1995 metal_emp2008
                          metalpdct_emp   ->   metalpdct_emp1995 metalpdct_emp2008
                          machinery_emp   ->   machinery_emp1995 machinery_emp2008
                           cptNinst_emp   ->   cptNinst_emp1995 cptNinst_emp2008
                                 ht_emp   ->   ht_emp1995 ht_emp2008
                              nonht_emp   ->   nonht_emp1995 nonht_emp2008
                               aprl_emp   ->   aprl_emp1995 aprl_emp2008
                             eduspt_emp   ->   eduspt_emp1995 eduspt_emp2008
                                geq_emp   ->   geq_emp1995 geq_emp2008
                                seq_emp   ->   seq_emp1995 seq_emp2008
                              trans_emp   ->   trans_emp1995 trans_emp2008
                              ptran_emp   ->   ptran_emp1995 ptran_emp2008
                                eeq_emp   ->   eeq_emp1995 eeq_emp2008
                               comm_emp   ->   comm_emp1995 comm_emp2008
                               inst_emp   ->   inst_emp1995 inst_emp2008
                                art_emp   ->   art_emp1995 art_emp2008
                           lghttrad_emp   ->   lghttrad_emp1995 lghttrad_emp2008
                            hvytrad_emp   ->   hvytrad_emp1995 hvytrad_emp2008
                         plstcNrbbr_emp   ->   plstcNrbbr_emp1995 plstcNrbbr_emp2008
                             allhvy_emp   ->   allhvy_emp1995 allhvy_emp2008
                             allmdm_emp   ->   allmdm_emp1995 allmdm_emp2008
-----------------------------------------------------------------------------

. rename *_emp???? *_emp????_cp90

. tempfile cp

. save `cp'
file C:\Users\NATHAN~1\AppData\Local\Temp\ST_02000004.tmp saved

. 
. merge 1:1 cc05 using `p', nogen

    Result                           # of obs.
    -----------------------------------------
    not matched                             0
    matched                               286  
    -----------------------------------------

. 
. sort cc05

. save $out2, replace
file ..\..\data\empcensus\generated\emp_count_newind.dta saved

. 
. log close
      name:  <unnamed>
       log:  D:\research\china\decentralization\dofiles\tab_data\tabdata5-3empcen.log
  log type:  text
 closed on:  29 Jul 2014, 12:09:45
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
